*------------------------------------------------------------------------------*
* Family history - Dinas, Fouka, Schläpfer - JoP
*------------------------------------------------------------------------------*

*------------------------------------------------------------------------------*
* Figure 3
*------------------------------------------------------------------------------*



*------------------------------------------------------------------------------*
* Greece
*------------------------------------------------------------------------------*

use greece, clear
keep if asiaminor==0
keep ref28

tempfile temphist
save `temphist'

use greece, clear

keep if asiaminor==0
gen tref28=T*ref28


local controls female i.age i.edu i.occupation i.income i.nomos 
estimates clear

forval nn=1/3 {
	gen inter_`nn'=T*(newref==`nn')
}


tempfile temper0 temper1
reg pc_behst i.mdist  `controls'  inter_1 inter_2 inter_3 , cl(municipality)
parmest,label saving(`temper0')   level(90 95)

reg pc_all_bst i.mdist  `controls' inter_1 inter_2 inter_3 , cl(municipality)
parmest,label saving(`temper1')   level(90 95)

use `temper0', clear
append using `temper1', gen(origin)

keep if parm=="inter_1" | parm=="inter_2" | parm=="inter_3"

gen id=mod(_n-1,3)
replace id=3*id+origin+1
label define cat 1 "Low" 2 "Medium" 3 "High" 
label values id cat

append using `temphist'


qui sum ref28
gen rr2=0+(ref28-r(min))/(r(max)-r(min))*(9-0)
twoway  (histogram rr2, yscale(alt axis(1)) frac  color(gs15))  ///
		(scatter estimate id if origin==0, yaxis(2) msymbol(square) msize(large) yscale(alt axis(2)) color(red)) 		///
		(scatter estimate id if origin==1, yaxis(2) msymbol(triangle) msize(large) color(blue) yline(0, axis(2) lcolor(black) lpattern(dash))) ///
		(rcap  max90 min90 id , yaxis(2) color(black)), xlabel( 1.5 "Low" 4.5 "Medium" 7.5 "High") ///
		 legend(off) ///
		xtitle("1928 Refugee Share") ytitle("Treatment Effect", axis(2)) ytitle("", axis(1)) ///
	   scheme(s1color) aspect(1) subtitle("Greece")
	   
graph save greek_share, replace



*------------------------------------------------------------------------------*
* Germany
*------------------------------------------------------------------------------*

use germany, clear
keep if expellee==0

keep exp_share

tempfile tempshare
save `tempshare'

use germany, clear
keep if expellee==0

local controls i.sex i.state i.age realschule abitur university i.F13 

forval nn=1/3 {
	gen inter_`nn'=t1*(newref==`nn')
}

tempfile tempera0 tempera1
reg donate_st i.GKZ  `controls'  inter_1 inter_2 inter_3 , cl(GKZ)
parmest,label saving(`tempera0')   level(90 95)

reg pc_att i.GKZ  `controls' inter_1 inter_2 inter_3 , cl(GKZ)
parmest,label saving(`tempera1')   level(90 95)

use `tempera0', clear
append using `tempera1', gen(origin)

keep if parm=="inter_1" | parm=="inter_2" | parm=="inter_3"

gen id=mod(_n-1,3)
replace id=3*id+origin+1
label define cat 1 "Low" 2 "Medium" 3 "High" 
label values id cat

append using `tempshare'



qui sum exp_share
gen rr2=0+(exp_share-r(min))/(r(max)-r(min))*(9-0)
twoway  (histogram rr2, yscale(alt axis(1)) frac  color(gs15))  ///
		(scatter estimate id if origin==0, msymbol(square) msize(large) yaxis(2) yscale(alt axis(2)) color(red)) 		///
		(scatter estimate id if origin==1, msymbol(triangle) msize(large) yaxis(2) color(blue) yline(0, axis(2) lcolor(black) lpattern(dash)) )  ///
		(rcap  max90 min90 id , yaxis(2) color(black)), xlabel( 1.5 "Low" 4.5 "Medium" 7.5 "High") ///
		 legend(off) ///
		xtitle("1952 Refugee Share") ytitle("Treatment Effect", axis(2)) ytitle("", axis(1)) ///
		legend(row(2) order(2 "Quasi-behavioral/Donation" 3 "Attitudes") ring(0) position(8) bmargin(none) size(small) region(lc(none) fc(none) ls(none)) symxsize(large)) ///
	   scheme(s1color) aspect(1) subtitle("Germany")

graph save german_share, replace 

*------------------------------------------------------------------------------*
* Combine
*------------------------------------------------------------------------------*

grc1leg greek_share.gph german_share.gph, legendfrom(german_share.gph) position(6) ring(0)
